gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\linear\anderson\andrerr.m

    function [maxError,minr]=andrerr(MI,SIGMA,J,alpha,theta)
% ANDRERR classification erorr, Generalized Anderson's task.
% [maxError,minr]=andrerr(MI,SIGMA,J,alpha,theta)
%
% ANDERROR computes upper limit of probability of a wrong
%   classification in the Generalized Anderson's task (GAT) for
%   given solution. For more details on GAT refer to book SH10
%   or functions GANDERS, GANDERS2, EANDERS.
%
%   Input matrices MI, SIGMA and vector J describe input of the
%   GAT and pair alpha, theta is given solution of the GAT.
%
% Input:
%  MI [NxK] cointains N-dimensinal vectors of mean values for
%     K normal distributions so that MI=[Mi1,Mi2,...,MiK].
%  SIGMA [Nx(N*K)] contains N-by-N covariance matrices again for
%     K normal distributions, SIGMA=[Sigma1,Sigma2,...,SigmaK].
%  J [1xK] contains labels for each pair {Mi,Sigma}, for example
%     J(1) is label for first pair Mi1, Sigma1.
%  alpha [Nx1], theta [1x1] normal vector alpha and threshold theta
%     determine solution of the GAT.
%
% Output:
%  maxError [1x1] is upper limit of probability of bad classification.
%  minr [1x1] is parameter of solution of the GAT which determines
%    radius of the smallest ellipsoid. For more detail see SH10.
%

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 02.01.2000
% Modifications
% 24. 6.00 V. Hlavac, comments polished.

% get dimension N and number of distributions
N=size(MI,1);
K=size(MI,2);

%
[alpha,MI,SG]=ctransf(alpha,theta,MI,J,SIGMA);

% find distances between MIs and contact points
minr=min((alpha'*MI)./sqrt( reshape(alpha'*SG,N+1,K)'*alpha )');

% computes maximal error
maxError=1-cdf('norm',minr,0,1);